package cn.net.csit.platform_cloud.basicmodel.service.impl;

import cn.net.csit.platform_cloud.base.PtColumnModel;
import cn.net.csit.platform_cloud.basicmodel.mapper.BackupDataMapper;
import cn.net.csit.platform_cloud.basicmodel.service.IBackupDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BackupDataServiceImpl implements IBackupDataService {
    @Autowired
    private BackupDataMapper backupDataMapper;;

    @Override
    public void createTable(String NewTableName, List<Map<String, String>> columnNameList) {
        backupDataMapper.createTable(NewTableName,columnNameList);
    }

    @Override
    public void createNullTable(java.lang.String NewTableName) {
        backupDataMapper.createNullTable(java.lang.String.valueOf(NewTableName));
    }

    @Override
    public void deleteTable(String NewTableName) {
        backupDataMapper.deleteTable(NewTableName);
    }

    @Override
    public void truncateTable(String NewTableName) {
        backupDataMapper.truncateTable(NewTableName);
    }

    @Override
    public void addColumnList(String tableName, List<String> columnNameList) {
        backupDataMapper.addColumnList(java.lang.String.valueOf(tableName),columnNameList);

    }

    @Override
    public void addColumns(String tableName, List<PtColumnModel> columnNameList) {
        backupDataMapper.addColumns(tableName,columnNameList);
    }

    @Override
    public void delColumns(String tableName, List<String> columnNameList) {
        backupDataMapper.delColumns(java.lang.String.valueOf(tableName),columnNameList);
    }

    @Override
    public String isTargetTableExistInDB(String dataBaseName,String NewTableName) {
        String res= backupDataMapper.isTargetTableExistInDB(dataBaseName,NewTableName);
        return res;
    }

    public List<Map<String,String>> customQueryItem(StringBuilder sqlContent) {
        List<Map<String,String>> res=backupDataMapper.customQueryItem(sqlContent);
        return res;
    }


}
